package database

import (
	"github.com/go-xorm/xorm"
	_ "github.com/mattn/go-sqlite3"
	"os"
)

var Engine *xorm.Engine

func InitDb(){
	var err error
	Engine,err = xorm.NewEngine("sqlite3", "../test.db")
	if err !=nil{
		panic(err)
	}
	logger := xorm.NewSimpleLogger(os.Stdout)
	logger.ShowSQL(true)
	Engine.SetLogger(logger)

	err = Engine.Sync(new(User),new(Comment))
	if err !=nil{
		panic(err)
	}
}